package com.cbgolf.oa.manager;

import android.content.Context;
import android.content.Intent;
import com.amap.api.location.AMapLocation;
import com.cbgolf.oa.service.LocationService;

/**
 * Created by lq on 2018/5/3.
 */

public class LocationManager {


  LocationManager() {

  }

  private static class Inner {

    public static LocationManager manager = new LocationManager();
  }

  public static LocationManager getInstance() {
    return Inner.manager;
  }

  public LocationManager setWorker(ILocationWaiter worker) {
    this.worker = worker;
    return this;
  }

  public void startLocation(Context context, ILocationWaiter worker) {
    Intent intent = new Intent(context, LocationService.class);
    context.startService(intent);
    LocationService.setWorker(worker);

  }

  private ILocationWaiter worker;

  public interface ILocationWaiter {

    void locationSuccess(AMapLocation location);

    void locationFail();
  }


}
